home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d12
/
snip9_91.arc
/
BITCOUNT.C
< prev
next >
Wrap
Text File
|
1991-09-17
|
326b
|
16 lines
/****** BIT COUNTER *************/
bit_count(x)
{
int n=0;
if (x) do
n++;
while(x=x&(x-1));
return(n);
}/*******************************/
/*
** The loop will execute once for each bit of x set, this is in average
** twice as fast as the shift/test method.
*/